﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace NGUYENTHANHDONG.Excercise.Bai4
{
    public partial class TinhNgayTheoThang : Form
    {
        public TinhNgayTheoThang()
        {
            InitializeComponent();
        }

        private void btnXacNhan_Click(object sender, EventArgs e)
        {
            erpLoi.Clear();

            if(string.IsNullOrEmpty(txtNgay.Text))
            {
                erpLoi.SetError(txtNgay, "Khong dc de trong !!");
                txtNgay.Focus();
            }
            else
            {
                UserEntity objUser = new UserEntity(double.Parse(txtNgay.Text), double.Parse(cmbNam.Text));

                CONTROLLERS con = new CONTROLLERS();

                lsbDanhSach.Items.Add("+ Tháng " + objUser.THANG + " Nam : " + objUser.NAM + " co " + con.chuyendoi(objUser) + " ngay !!");
            }
        }

        private void TinhNgayTheoThang_Load(object sender, EventArgs e)
        {
            for(int i = 1990; i<= 2100; i++)
            {
                cmbNam.Items.Add(i + " ");
            }
            cmbNam.SelectedIndex = 0;
        }
    }
}
